package com.app.zenmewan;

import org.springframework.web.servlet.tags.EditorAwareTag;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;

public class test {
    public static void main(String[] args) throws ParseException {
        SimpleDateFormat sdf = new SimpleDateFormat();
        sdf.applyPattern("yyyy-MM-dd HH:mm:ss SSS");
        //1483158746123L 46是秒 123是毫秒
        String dateTime = "2020-05-02 15:30:16 905";
        Calendar calendar = Calendar.getInstance();
        calendar.setTime(sdf.parse(dateTime));
        long s = calendar.getTimeInMillis();
        System.out.println( sdf.parse(dateTime)+ ":" +  s);
        //试试多加1min
        long millisecond = s+(1000L*60)*30;
        System.out.println("//"+millisecond);
        dateTime = sdf.format(millisecond);
        calendar.setTime(sdf.parse(dateTime));
        System.out.println( dateTime+ ":" +  millisecond);
        System.out.println("差距:"+(millisecond-s));
    }
}
